import request from '@/utils/request'
// import axios from 'axios'
import { apiVersion } from '@/config'
// import { getDeviceId } from '@/utils/tool'


// 获取详情
export function getImageDetail(data) {
    return request({
        url: `/admin/${apiVersion}/image/${data.id}`,
        method: 'get',
        data
    })
}
// 分页列表
export function getImages(data) {
    return request({
        url: `/admin/${apiVersion}/image`,
        method: 'get',
        data
    })
}
// 删除
export function delImage(data) {
    return request({
        url: `/admin/${apiVersion}/image/${data.id}`,
        method: 'delete',
        data
    })
}
// 创建
export function addImage(data) {
    return request({
        url: `/admin/${apiVersion}/image`,
        method: 'post',
        data
    })
}
export function putImage(data) {
    return request({
      url: `/admin/${apiVersion}/image`,
      method: 'put',
      data: data
    })
  }
export function buildImage(data) {
    return request({
        url: `/admin/${apiVersion}/image/${data.id}/build/start`,
        method: 'put',
        data: data
    })
}

export function buildImageTar(data) {
    return request({
        url: `/admin/${apiVersion}/image/${data.id}/push`,
        method: 'post',
        data: data
    })
}


export function stopBuildImage(data) {
    return request({
        url: `/admin/${apiVersion}/image/${data.id}/build/stop`,
        method: 'put',
        data: data
    })
}

// 查询列表
export function getAllImages(data) {
    return request({
        url: `/admin/${apiVersion}/image/all`,
        method: 'get',
        data
    })
}

// 获取pod名称
export function getImagePodName(data) {
    return request({
        url: `/admin/${apiVersion}/image/${data.id}/podName`,
        method: 'get',
        data
    })
}
// 查询列表
export function getAllImageGroups() {
    return request({
        url: `/admin/${apiVersion}/image/group`,
        method: 'get'
    })
}
